package com.regent.central.infrastructure.service;

import java.util.List;

/**
 * Created by kk 胡振立 on 2018/5/6.
 */
public interface DomainService<T> {

    T selectOne(T entity);

    T selectById(Object id);

    List<T> selectList(T entity);

    List<T> selectListAll();

    Long selectCount(T entity);

    int insert(T entity);

    int insertSelective(T entity);

    int delete(T entity);

    int deleteById(Object id);

    int deleteByExample(Object example);

    int updateById(T entity);

    int updateSelectiveById(T entity);

    int updateByPrimaryKeySelective(T entity);

    int updateByExampleSelective(T entity, Object example);

    List<T> selectByExample(Object example);

    int selectCountByExample(Object example);

    <T> T doAtomically(Atom<T> atom);

    /**
     * 多个事务方法的原子性操作
     */
    interface Atom<T> {

        T execute();

    }

}
